//
//  HMStatusToolView.swift
//  sina
//
//  Created by Kent on 16/9/28.
//  Copyright © 2016年 Ming. All rights reserved.
//

import UIKit

class HMStatusToolView: UIView {

    var viewModel: HMStatusViewModel? {
        didSet {
            
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        addBottomInfoSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func addBottomInfoSubviews() {

        self.snp.makeConstraints { (make) in
            make.height.equalTo(40)
        }
        
        self.addSubview(forwardBtn)

        cons(view: forwardBtn, constraintedFromView: self)
        
        self.addSubview(commentBtn)
        
        cons(view: commentBtn, constraintedFromView: forwardBtn)
        
        self.addSubview(likeBtn)
        
        cons(view: likeBtn, constraintedFromView: commentBtn)
        
    }
    
    func cons(view: UIView, constraintedFromView: UIView) {
        let btnWidth = CGFloat(ScreenWidth / 3)
        
        view.snp.makeConstraints { (make) in
            if constraintedFromView == self {
                make.left.equalTo(self)
            } else {
                make.left.equalTo(constraintedFromView.snp.right)
            }
            make.centerY.height.equalTo(self)
            make.width.equalTo(btnWidth)
        }
    }
    
    lazy var forwardBtn: UIButton = {
        let b = UIButton(nrtitle: "转发", fontSize: 13, textColor: UIColor.orange)
        b.setImage(#imageLiteral(resourceName: "timeline_icon_retweet"), for: .normal)
        return b
    }()
    
    lazy var commentBtn: UIButton = {
        let b = UIButton(nrtitle: "评论", fontSize: 13, textColor: UIColor.orange)
        b.setImage(#imageLiteral(resourceName: "timeline_icon_comment"), for: .normal)
        return b
    }()
    
    lazy var likeBtn: UIButton = {
        let b = UIButton(nrtitle: "赞", fontSize: 13, textColor: UIColor.orange)
        b.setImage(#imageLiteral(resourceName: "timeline_icon_unlike"), for: .normal)
        return b
    }()
    
    
    
}
